package com.yuwj.chinaa.activity;

import android.content.Context;
import android.content.Intent;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yuwj.chinaa.R;
import com.yuwj.chinaa.base.BaseActivity;
import com.yuwj.chinaa.base.ConstantParam;
import com.yuwj.chinaa.presenter.IPresenter;
import com.yuwj.chinaa.presenter.presenterImpl.PresenterImpl;

import butterknife.BindView;
import butterknife.OnClick;

public class WalletActivity extends BaseActivity {

    IPresenter presenter;
    int accountType;
    @BindView(R.id.rl_back)
    RelativeLayout rlBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_total)
    TextView tvTotal;
    @BindView(R.id.tv_total_unit)
    TextView tvTotalUnit;
    @BindView(R.id.tv_cny)
    TextView tvCny;
    @BindView(R.id.tv_available)
    TextView tvAvailable;
    @BindView(R.id.tv_freez)
    TextView tvFreez;
    @BindView(R.id.ll_base_info_container)
    LinearLayout llBaseInfoContainer;
    @BindView(R.id.ll_recharge)
    LinearLayout llRecharge;
    @BindView(R.id.ll_withdraw_deposit)
    LinearLayout llWithdrawDeposit;
    @BindView(R.id.ll_menu_container)
    LinearLayout llMenuContainer;
    @BindView(R.id.rv_trading_record)
    RecyclerView rvTradingRecord;
    @BindView(R.id.wrl_trading_record)
    SwipeRefreshLayout wrlTradingRecord;
    @BindView(R.id.detail_record_container)
    LinearLayout detailRecordContainer;
    @BindView(R.id.tv_another_account_type)
    TextView tvAnotherAccountType;
    @BindView(R.id.ll_another_account_type)
    LinearLayout llAnotherAccountType;

    public static Intent createIntent(Context context, int accountType) {
        Intent intent = new Intent(context, WalletActivity.class);
        intent.putExtra("accountType", accountType);
        return intent;
    }

    @Override
    public int setCustomContentViewResourceId() {
        return R.layout.activity_wallet;
    }

    @Override
    public void initParam() {
        Intent intent = getIntent();
        accountType = intent.getIntExtra("accountType", ConstantParam.ACCOUNT_TYPE_WITH_GTE);
        presenter = new PresenterImpl(this);
    }

    @Override
    public void initView() {
    }

    @Override
    public void initOperator() {

    }

    @OnClick({R.id.ll_recharge, R.id.ll_withdraw_deposit, R.id.ll_another_account_type})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_recharge:
                startActivity(TransferRechargeActivity.createIntent(context, accountType));
                break;
            case R.id.ll_withdraw_deposit:
                startActivity(TransferTransferActivity.createIntent(context, accountType));
                break;
            case R.id.ll_another_account_type:
                if (accountType == ConstantParam.ACCOUNT_TYPE_WITH_GTE) {
                    accountType = ConstantParam.ACCOUNT_TYPE_WITH_GTK;
                } else {
                    accountType = ConstantParam.ACCOUNT_TYPE_WITH_GTE;
                }
                break;
        }
    }
}
